#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTcpServer>
#include <QTcpSocket>
#include <QString>
#include "deb.h" //包含调试窗口头文件
#include<QSqlDatabase>/*数据库相关*/
#include "database.h"
#include "info.h"
#include <QPushButton>
/*-------------class------------------*/
class QLabel;
class QString;
class QTimer;
class QDebug;


QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    void test(QString buf);

    QTcpServer *tcpServer = new QTcpServer(); //网络服务器
    QTcpSocket *tcpSocket = new QTcpSocket(); //网络客户端


//私有变量
private:
    Ui::MainWindow *ui;

    void system_init();
    void statusbar_init();
    void creatChart1();// 创建表1
    void creatChart2();// 创建表2


    void DisplayChart1();
    void DisplayChart2();

    //定时器1
    QTimer *timer1;
    //定时器2
    QTimer *timer2;
    // 状态栏声明
    QLabel *statusLabel;
    //说明按钮类
    QPushButton *btn_info;

    //声明一个时间显示控件
    QLabel *currentTimeLabel;

    //定义调试窗口类
    Deb *deb = new Deb;

    //定义数据库窗口类
    database *data_base = new database;

    //定义说明窗口
    info *info_widget = new info;

    void BackDataParsing(QString strBuf);//数据解析函数
    void ToUpdata_Lab(QString Stemp,QString Shumi,QString Slight,QString Ssoil,QString Smq2,QString Srain);

    //
//私有槽函数
private slots:

    void ReData_Slot(); //获取数据槽函数
    void newConnection_Slot(); //网络通信槽函数
    void readyRead_Slot(); //读取套接字槽函数
    void disconnected_Slot();//
    void connected_Slot();
    void time_send_Slot();


    void on_led_triggered();
    void on_relay_triggered();
    void on_open_wifi_triggered();
    void on_set_yu_bt_clicked();
    void on_clear_yu_bt_clicked();
    void on_checkBox_soil_stateChanged(int arg1);
    void on_checkBox_rain_stateChanged(int arg1);
    void on_checkBox_temp_stateChanged(int arg1);
    void on_checkBox_light_stateChanged(int arg1);
    void on_debb_triggered();

    void on_auto_hand_triggered();
    void on_exit_triggered();
    void on_charts1_big_clicked();
    void on_charts1_small_clicked();
    void on_charts1_rest_clicked();
    void on_charts1_big_2_clicked();
    void on_charts1_small_2_clicked();
    void on_charts1_rest_2_clicked();
    void on_charts1_clear_1_clicked();
    void on_charts1_clear_2_clicked();
    void on_sermode_clicked();
    void on_set_light_bt_clicked();

    void on_horizontalSlider_valueChanged(int value);
    void on_data_triggered();
    void on_info_triggered();
};
#endif // MAINWINDOW_H
